# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Session do
  @moduledoc """
  External session proto definition.

  ## Attributes

  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Optional. The display name of the session. This field is used to identify the session in the UI. By default, the display name is the first turn query text in the session.
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time the session finished.
  *   `isPinned` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether the session is pinned, pinned session will be displayed on the top of the session list.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. Fully qualified name `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*`
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time the session started.
  *   `state` (*type:* `String.t`, *default:* `nil`) - The state of the session.
  *   `turns` (*type:* `list(GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SessionTurn.t)`, *default:* `nil`) - Turns.
  *   `userPseudoId` (*type:* `String.t`, *default:* `nil`) - A unique identifier for tracking users.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :displayName => String.t() | nil,
          :endTime => DateTime.t() | nil,
          :isPinned => boolean() | nil,
          :name => String.t() | nil,
          :startTime => DateTime.t() | nil,
          :state => String.t() | nil,
          :turns =>
            list(GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SessionTurn.t())
            | nil,
          :userPseudoId => String.t() | nil
        }

  field(:displayName)
  field(:endTime, as: DateTime)
  field(:isPinned)
  field(:name)
  field(:startTime, as: DateTime)
  field(:state)

  field(:turns,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SessionTurn,
    type: :list
  )

  field(:userPseudoId)
end

defimpl Poison.Decoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Session do
  def decode(value, options) do
    GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Session.decode(value, options)
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1Session do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
